package com.beiing.tianshuai.tianshuai.message.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.CodeBean;
import com.beiing.tianshuai.tianshuai.entity.MyFriendListBean;
import com.beiing.tianshuai.tianshuai.message.model.GroupAddMembersModel;
import com.beiing.tianshuai.tianshuai.message.model.GroupAddMembersModelImpl;
import com.beiing.tianshuai.tianshuai.message.view.GroupAddMembersViewImpl;

/**
 * Created by Jinni on 2017/9/22 0022.
 */

public class GroupAddMembersPresenter extends BasePresenter implements GroupAddMembersPresenterImpl,
        GroupAddMembersModel.OnRequestListener{

    private GroupAddMembersViewImpl mView;
    private GroupAddMembersModelImpl mModel;

    public GroupAddMembersPresenter(GroupAddMembersViewImpl view) {
        mView = view;
        mModel = new GroupAddMembersModel(this);
    }

    @Override
    public void getAllConstantsRequestResponse(String uid) {
        mModel.getAllConstantsRequestResponse(uid);
    }

    @Override
    public void getAddMembersRequestResponse(String gid, String easeGid, String fId, String tId, String isOwner) {
        mView.showProgress();
        mModel.getAddMembersRequestResponse(gid, easeGid, fId, tId, isOwner);
    }

    @Override
    public void onSuccess(CodeBean bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onGetConstantsSuccess(MyFriendListBean bean) {
        mView.getAllConstantsSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }
}
